/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.googlecode.j4sc.submission;

import java.net.URI;

import com.googlecode.j4sc.UserCredentials;
import com.googlecode.j4sc.conversion.Conversion;
import com.googlecode.j4sc.service.Service;

/**
 * The SubmissionReference class is returned as a result of calling the
 * {@link Service#submit(Submission)} method
 * <p>
 * It contains the URI location of where the Conversion will be made available
 * as well as the {@link UserCredentials} required to retrieve the
 * {@link Conversion} using the {@link Service#retrieve(SubmissionReference)}
 * method
 * 
 * @author Raj Patel, Dariusz Lorenc
 */
public class SubmissionReference {

    private final URI uri;
    private final UserCredentials userCredentials;
    private final String reference;

    /**
     * Construct a new instance
     * 
     * @param uri
     *            the URI location of where the conversion will be made
     *            available once processed
     * @param userCredentials
     *            the {@link UserCredentials} used to submit the submission and
     *            required to retrieve the conversion
     * @param reference
     *            the unique reference for the submission
     */
    public SubmissionReference(URI uri, UserCredentials userCredentials, String reference) {
        this.uri = uri;
        this.userCredentials = userCredentials;
        this.reference = reference;
    }

    /**
     * Gets the URI location of the conversion
     * 
     * @return the URI location
     */
    public URI getUri() {
        return uri;
    }

    /**
     * Gets the UserCredentials which are required to retrieve the conversion
     * 
     * @return the {@link UserCredentials}
     */
    public UserCredentials getUserCredentials() {
        return userCredentials;
    }

    /**
     * Gets the unique reference for the related {@link Submission}
     * 
     * @return the reference
     */
    public String getReference() {
        return reference;
    }
}
